1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to memory access control, and more particularly, to memory access control in a system to which virtualization is applied.
2. Description of the Related Art
Virtualization is a technique that virtualizes hardware resources including processors, memories, networks, devices and graphic functions for operating systems. Most operating systems are executed on the assumption that they exclusively possess computer resources. Accordingly, it is impossible to simultaneously execute a plurality of operating systems on a single computer because a conflict between the plurality of the operating systems occurs. Virtualization provides a virtual hardware interface for an operating system between the hardware and the operating system and enables simultaneous execution of multiple operating systems on a single computer.
Even though virtualization has been developed for server consolidation, it is also applied to embedded systems, such as cellular phones, personal digital assistants (PDAs), digital multimedia broadcasting (DMB) terminals, as an essential element for implementing secure mobile devices in a third generation (3G) environment or greater.
FIG. 1 illustrates a concept of a system 10 to which a related art virtualization technique is not applied. Referring to FIG. 1, the system 10 includes hardware 11, an operating system kernel 12, and a plurality of applications 13. The operating system kernel 12 is software responsible for security access to the hardware 11 and some of the applications 13 of a computer. Since there are many applications 13 and the system resources are limited, the operating system kernel 12 must determine the time for when one of the applications 13 uses the system resources and the number of resources used by the application 13. This process is referred to as scheduling.
The operating system kernel 12 and the applications 13 share a single page table and exist in the same address space, in general. In this case, the applications 13 have to be controlled such that they cannot violate a memory domain allocated to the operating system kernel 12.
A microprocessor provides two execution modes, that is, a privileged mode and an unprivileged mode. The privileged mode enables software to perform a limited operation that operates on an important part of a system, such as a memory and an input/output device. The applications 13 cannot be executed in the privileged mode, and the operating system kernel 12 or a driver (not shown) that is used for controlling devices connected to the system can be executed in the privileged mode. That is, programs executed in the privileged mode are permitted to freely access the memory and the system resources. On the contrary, programs executed in the unprivileged mode are restrained from accessing a specific memory domain and/or a device system. Accordingly, the applications 13 are prevented from violating the memory domain of the operating system kernel 12 by making the operating system kernel 12 access a section of memory in the privileged mode and making the applications 13 access another section of the memory in the unprivileged mode.
FIG. 2 illustrates a concept of a system 20 to which the related art virtualization technique is applied. Referring to FIG. 2, the system 20 includes hardware 21, a virtual machine monitor (VMM) 22, a first guest operating system kernel 23, a second guest operating system kernel 24, a plurality of first applications 25, and a plurality of second applications 26. In this case, an environment in which the first and second guest operating system kernels 23 and 24 are executed is referred to as a virtual machine (VM).
In the case of a processor having subdivided execution modes, such as a high-performance x86 processor, access modes can be set for respective memory domains to control memory access. Specifically, a VMM mode in which the VMM 22 is executed, a VM kernel mode in which the first and second guest operating system kernels 23 and 24 are executed, and a VM user mode in which the first and second applications 25 and 26 are executed can be respectively defined.
In the case of systems only having the privileged mode and the unprivileged mode, such as embedded systems, the VMM 22 is executed in the privileged mode and the first and second guest operating system kernels 23 and 24 as well as the first and second applications 25 and 26 are executed in the unprivileged mode. In this case, the first and second guest operating system kernels 23 and 24 and the first and second applications 25 and 26 are executed in the same execution mode, and thus, the execution mode is required to be subdivided. Accordingly, the unprivileged mode is divided into a VM kernel mode in which the first and second guest operating system kernels 23 and 24 are executed and a VM user mode in which the first and second applications 25 and 26 are executed.
However, the VM kernel mode and the VM user mode have the same memory access permissions because the VM kernel mode and the VM user mode both execute in the unprivileged mode. That is, the memory domains allocated to the first and second guest operating system kernels 23 and 24 are also accessible in the VM user mode.